/**
 * Created by cfm on 16-12-3.
 */
// get the model
var model = document.getElementById("myModel");

// get the button that opens the model
var btn = document.getElementById("myBtn");

// get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// when the user clicks on the button, open the model
btn.onclick = function () {
    model.style.display="block";
}

// When the user clicks on <span> (x),close the model
span.onclick = function () {
    model.style.display = "none";
}

// when the user clicks anywhere outside of the model, close it

window.onclick =function (event) {
    if (event.target == model){
        model.style.display = "none";
    }
}